<?php
/**
 * Created by PhpStorm.
 * User: hui
 * Date: 2016/9/27
 * Time: 11:02
 */
namespace app\index\validate;

use think\Validate;

class Member extends Validate
{
    protected $rule = [
        'plate'      => 'regex:/[\x80-\xff][A-Z][a-z0-9]{5}/i|require|max:7',
        'password'   => 'require',
        'o_password' => 'require',
        'n_password' => 'require|length:1,120',
        'r_password' => 'require|confirm:n_password',
    ];

    protected $message = [
        'plate'              => '请输入正确的车牌',
        'plate.require'      => '请输入车牌',
        'password'           => '请输入密码',
        'o_password'         => '请输入旧密码',
        'n_password.require' => '请输入新密码',
        'n_password.length'  => '新密码的长度不能超过120',
        'r_password.require' => '请再次输入新密码',
        'r_password.confirm' => '两次输入密码不一致',
    ];

    protected $scene = [
        'login' => ['plate', 'password'],
        'edit'  => ['o_password', 'n_password', 'r_password'],
    ];
}